- name: coreos.general
  rules:
  - alert: DeadMansSwitch
    expr: vector(1)
    labels:
      severity_level: "4"
    annotations:
      plk_protocol_version: "1"
      description: This is a DeadMansSwitch meant to ensure that the entire Alerting
        pipeline is functional.
      summary: Alerting DeadMansSwitch
  - record: fd_utilization
    expr: process_open_fds / process_max_fds
  - alert: FdExhaustionClose
    expr: max(predict_linear(fd_utilization{pod!=""}[1h], 3600 * 4)) BY (job, namespace, pod) > 1
    for: 10m
    labels:
      severity_level: "4"
    annotations:
      plk_protocol_version: "1"
      description: '{{ $labels.job }}: {{ $labels.namespace }}/{{ $labels.pod }} instance
        will exhaust in file/socket descriptors within the next 4 hours'
      summary: file descriptors soon exhausted
  - alert: FdExhaustionClose
    expr: max(predict_linear(fd_utilization{pod=""}[1h], 3600 * 4)) BY (job, instance) > 1
    for: 10m
    labels:
      severity_level: "4"
    annotations:
      plk_protocol_version: "1"
      description: '{{ $labels.job }}: {{ $labels.instance }} instance
        will exhaust in file/socket descriptors within the next 4 hours'
      summary: file descriptors soon exhausted
  - alert: FdExhaustionClose
    expr: max(predict_linear(fd_utilization{pod!=""}[10m], 3600)) BY (job, namespace, pod) > 1
    for: 10m
    labels:
      severity_level: "3"
    annotations:
      plk_protocol_version: "1"
      description: '{{ $labels.job }}: {{ $labels.namespace }}/{{ $labels.pod }} instance
        will exhaust in file/socket descriptors within the next hour'
      summary: file descriptors soon exhausted
  - alert: FdExhaustionClose
    expr: max(predict_linear(fd_utilization{pod=""}[10m], 3600)) BY (job, instance) > 1
    for: 10m
    labels:
      severity_level: "3"
    annotations:
      plk_protocol_version: "1"
      description: '{{ $labels.job }}: {{ $labels.instance }} instance
        will exhaust in file/socket descriptors within the next hour'
      summary: file descriptors soon exhausted
